﻿Ext.define('I2R.view.deptformpanel', {
    extend: 'Ext.form.Panel',
    alias: 'widget.i2rdeptformpanel',
    bodyCls: 'padd-up',
    border: false,
    fieldDefaults: {
        labelAlign: 'left',
        labelWidth: 150,
        labelSeparator: ''
    },
    skipLoad: false,
    loadId: -1,
    initComponent: function () {

        var me = this;

        var userstore = Ext.data.StoreManager.lookup('users');

        me.items = [
            { xtype: 'textfield', name: 'Id', fieldLabel: '#', readOnly: true },
            { xtype: 'textfield', name: 'Name', fieldLabel: 'Name'},
            {
                xtype: 'combobox',
                name: 'Responsible',
                fieldLabel: 'Responsible',
                store: userstore,
                displayField: 'Fullname',
                valueField: 'Id'
            }
        ];

        me.callParent(arguments);

        if (!me.skipLoad) {
            me.load({ url: '/User/GetDepartment', method: 'GET', params: { Id: me.loadId} });
        }
    }
});

